package com.cdu.ai_intelligent_teaching_and_training_system.service;

import com.cdu.ai_intelligent_teaching_and_training_system.entity.Feedback;
import com.cdu.ai_intelligent_teaching_and_training_system.mapper.FeedbackMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class FeedbackService {
    @Autowired
    private FeedbackMapper feedbackMapper;

    public List<Feedback> findByCourseIdAndStudentId(Long courseId, Long studentId) {
        // 先查课程下所有反馈，再筛选studentId
        List<Feedback> all = feedbackMapper.selectByCourseId(courseId);
        return all.stream()
                .filter(f -> f.getStudentId() != null && f.getStudentId().equals(studentId))
                .collect(Collectors.toList());
    }
} 